package com.framework.sc.graphqldemo;

import com.framework.sc.graphqldemo.service.TripService;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class GraphqlDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(GraphqlDemoApplication.class, args);
    }

    @Bean
    ApplicationRunner init(TripService tripService) {
        return args -> {
//            Stream.of("Ferrari", "Jaguar", "Porsche", "Lamborghini", "Bugatti",
//                    "AMC Gremlin", "Triumph Stag", "Ford Pinto", "Yugo GV").forEach(name -> {
//                Trip trip = new Trip();
//                trip.setTitle(name);
////                tripService.saveCar(car);
//            });
            tripService.getTrips().forEach(System.out::println);
        };
    }
}
